import { http } from '../http';
import {
	GetKnowledgeRelationshipParamsType,
	GetKnowledgeRelationshipResponseType,
	GetKnowledgeGraphParamsType,
	GetKnowledgeGraphResponseType,
	GetKnowledgeDetailParamsType,
	GetKnowledgeDetailResponseType
} from './knowledge.type';

const aiasUrl = '/api/aias';

/**
 * @description 获取知识关系列表
 * @param {number} params.pageNum 当前页码 默认1 传0查全部
 * @param {number} params.pageSize 每页数量 默认30 传0查全部
 * @param {string} params.keyword 搜索关键词（关系名称）
 * @param {string} params.displayType 图谱呈现类型arrow（单向箭头）、none（无箭头）
 */
export const getKnowledgeRelationshipListAPI = (
	params: GetKnowledgeRelationshipParamsType
): Promise<GetKnowledgeRelationshipResponseType> => {
	return http.post(`${aiasUrl}/knowledge/relationship/list`, params);
};

/**
 * @description 查询知识点图谱
 * @param {string} params.businessCode 业务编号
 * @param {int} params.businessType 业务类型 1 - lesson、2 - course、3 - subject、4 - all
 */
export const getKnowledgeGraphAPI = (
	params: GetKnowledgeGraphParamsType
): Promise<GetKnowledgeGraphResponseType> => {
	return http.post(`${aiasUrl}/knowledge/graph/getKnowledgeGraph`, params);
};

/**
 * @description 查询课程/课堂知识点详情
 * @param {string} params.businessType 业务类型 1 - lesson、2 - course
 * @param {int} params.knowledgeId 知识点id
 */
export const getKnowledgeDetailAPI = (
	params: GetKnowledgeDetailParamsType
): Promise<GetKnowledgeDetailResponseType> => {
	return http.post(`${aiasUrl}/knowledge/graph/getKnowledgeDetail`, params);
};
